﻿using IntelligentAgriculture.Contracts.Interface;
using IntelligentAgriculture.Services.StartServices;
using IntelligentAgriculture.WebAPI.Application.Command.GermlineHistoryRecordsCommand;
using MediatR;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.GermlineHistoryRecordsCommandHandler
{

    /// <summary>
    /// 种母历史记录删除CommandHandler
    /// </summary>
    public class DeleteHistoryRecordCommandHandler:IRequestHandler<DeleteHistoryRecordCommand, Results<int>>
    {
        private readonly IHistoryRecordService _service;
        public DeleteHistoryRecordCommandHandler(IHistoryRecordService service)
        {
            _service = service;
        }

        public async Task<Results<int>> Handle(DeleteHistoryRecordCommand request, CancellationToken cancellationToken)
        {
            var list = await _service.DeleteHistoryrecord(request.HRId);
            return Results<int>.DataResult(list);
        }
    }
}
